 package ss.pku.jsa.type.inference;
 
 import ss.pku.jsa.type.constraint.solver.QError;
 
 public class MergeJob
   implements WorklistJob
 {
   private QType to;
   private QType from;
   private Location loc;
   private QError error;
 
   private MergeJob(QType from, QType to, Location loc, QError error)
   {
     this.from = from;
     this.to = to;
     this.loc = loc;
     this.error = error;
 
     if (JqualPlugin.showContraintMsgs)
       JqualPlugin.out.println("adding MERGE " + this);
   }
 
   public static void addMergeJob(QType from, QType to, Location loc, QError error) {
     if ((from == null) || (to == null)) {
       return;
     }
 
     if (!(from instanceof ObjectQType)) {
       from.merge(to, loc, error);
       return;
     }
     ObjectQType f = (ObjectQType)from;
 
     if ((f.getFieldQTypes().isEmpty()) && (f.getConstraints().isEmpty())) {
       from.merge(to, loc, error);
       return;
     }
 
     JqualPlugin.analysis.mergeWorklist.add(new MergeJob(from, to, loc, error));
   }
 
   public String toString() {
     return "MergeJob: " + this.from + " into " + this.to + " " + this.error;
   }
 
   public void apply()
   {
     if ((this.to == null) || (this.from == null))
       return;
     this.from.merge(this.to, this.loc, this.error);
   }
 }
